result = {}

with open("Walden.txt","r",encoding="utf-8") as f:
    txt = f.read().lower()
    for ch in '!#%&()*+,-./;<>\'=?@[]\\^_{|}~`\"':
        txt.replace(ch, "")
    txt_list = txt.split()
    # lst = txt.split()

txt_set = set(txt_list)
for i in txt_set:
    result.update({i: txt_list.count(i)})
print(result)
